﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace StatsData.Data.Migrations
{
    public partial class add_table_t_wip_work_hour_statis_machine_t_bi_wip_work_hour_statis_labor : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "T_BI_WIP_WORK_HOUR_STATIS_LABOR",
                columns: table => new
                {
                    ID = table.Column<string>(type: "VARCHAR2(50)", maxLength: 50, nullable: false),
                    WORK_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: false, defaultValue: ""),
                    WORK_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    PRODUCT_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: false, defaultValue: ""),
                    PRODUCT_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    LINE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    LINE_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    LINE_NAME = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    LINE_SUPERVISOR_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    LINE_SUPERVISOR_NAME = table.Column<string>(type: "NVARCHAR2(20)", maxLength: 20, nullable: true),
                    LINE_SUPERVISOR_CODE = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: true),
                    PROCEDURE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    PROCESS_VERSION = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    SECTION_CODE = table.Column<string>(type: "NVARCHAR2(20)", maxLength: 20, nullable: true),
                    WORK_LAST_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    WORK_BEGIN_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
                    WORK_END_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
                    OUTPUT_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    ACTUAL_MANPOWER = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    TOTAL_ACTUAL_LABOR_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    ACTUAL_LABOR_WORK_HOUR_UNIT = table.Column<string>(type: "NVARCHAR2(5)", maxLength: 5, nullable: true),
                    STANDARD_LABOR_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    STANDARD_LABOR_WORK_HOUR_UNIT = table.Column<string>(type: "NVARCHAR2(5)", maxLength: 5, nullable: true),
                    TOTAL_STANDARD_LABOR_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    BOTTLENECK_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    STANDARD_MANPOWER = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_RUN_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_FAILURE_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_STANDBY_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_FAILURE_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_STANDBY_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    HAS_MACHINE_STANDARD_TIME = table.Column<bool>(type: "NUMBER(1)", nullable: false),
                    WORKSHOP_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    SAP_PROCEDURE_CODE = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    ORG_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    CREATE_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    MODIFY_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    IS_DELETED = table.Column<bool>(type: "NUMBER(1)", nullable: false),
                    ROW_VERSION = table.Column<int>(type: "NUMBER(10)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_BI_WIP_WORK_HOUR_STATIS_LABOR", x => x.ID);
                });

            migrationBuilder.CreateTable(
                name: "T_BI_WIP_WORK_HOUR_STATIS_MACHINE",
                columns: table => new
                {
                    ID = table.Column<string>(type: "VARCHAR2(50)", maxLength: 50, nullable: false),
                    WORK_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: false, defaultValue: ""),
                    WORK_CODE = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: true),
                    PRODUCT_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: false, defaultValue: ""),
                    PRODUCT_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    LINE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    LINE_CODE = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    LINE_NAME = table.Column<string>(type: "NVARCHAR2(60)", maxLength: 60, nullable: true),
                    LINE_SUPERVISOR_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    LINE_SUPERVISOR_NAME = table.Column<string>(type: "NVARCHAR2(20)", maxLength: 20, nullable: true),
                    LINE_SUPERVISOR_CODE = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: true),
                    PROCEDURE_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    PROCESS_VERSION = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    SECTION_CODE = table.Column<string>(type: "NVARCHAR2(20)", maxLength: 20, nullable: true),
                    WORK_LAST_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    WORK_BEGIN_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
                    WORK_END_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true),
                    OUTPUT_QTY = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_RUN_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_FAILURE_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    MACHINE_STANDBY_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    BOTTLENECK_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    STANDARD_YIELD_RATE = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    STANDARD_MACHINE_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    STANDARD_MACHINE_WORK_HOUR_UNIT = table.Column<string>(type: "NVARCHAR2(600)", maxLength: 600, nullable: true),
                    TOTAL_STANDARD_MACHINE_WORK_HOUR = table.Column<decimal>(type: "NUMBER(18,6)", precision: 18, scale: 6, nullable: false),
                    WORKSHOP_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    SAP_PROCEDURE_CODE = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    ORG_ID = table.Column<string>(type: "NVARCHAR2(50)", maxLength: 50, nullable: true),
                    CREATE_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    MODIFY_TIME = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false),
                    IS_DELETED = table.Column<bool>(type: "NUMBER(1)", nullable: false),
                    ROW_VERSION = table.Column<int>(type: "NUMBER(10)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_T_BI_WIP_WORK_HOUR_STATIS_MACHINE", x => x.ID);
                });

            migrationBuilder.CreateIndex(
                name: "IX_T_BI_WIP_WORK_HOUR_STATIS_LABOR_CREATE_TIME",
                table: "T_BI_WIP_WORK_HOUR_STATIS_LABOR",
                column: "CREATE_TIME");

            migrationBuilder.CreateIndex(
                name: "IX_T_BI_WIP_WORK_HOUR_STATIS_LABOR_PRODUCT_ID",
                table: "T_BI_WIP_WORK_HOUR_STATIS_LABOR",
                column: "PRODUCT_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_BI_WIP_WORK_HOUR_STATIS_LABOR_WORK_ID",
                table: "T_BI_WIP_WORK_HOUR_STATIS_LABOR",
                column: "WORK_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_BI_WIP_WORK_HOUR_STATIS_MACHINE_CREATE_TIME",
                table: "T_BI_WIP_WORK_HOUR_STATIS_MACHINE",
                column: "CREATE_TIME");

            migrationBuilder.CreateIndex(
                name: "IX_T_BI_WIP_WORK_HOUR_STATIS_MACHINE_PRODUCT_ID",
                table: "T_BI_WIP_WORK_HOUR_STATIS_MACHINE",
                column: "PRODUCT_ID");

            migrationBuilder.CreateIndex(
                name: "IX_T_BI_WIP_WORK_HOUR_STATIS_MACHINE_WORK_ID",
                table: "T_BI_WIP_WORK_HOUR_STATIS_MACHINE",
                column: "WORK_ID");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "T_BI_WIP_WORK_HOUR_STATIS_LABOR");

            migrationBuilder.DropTable(
                name: "T_BI_WIP_WORK_HOUR_STATIS_MACHINE");
        }
    }
}
